package restaurant.gui;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import restaurant.Comment;
import restaurant.CustomerComments;
import restaurant.CustomerOrders;
import restaurant.CustomerTabs;
import restaurant.InformationAggregator;
import restaurant.Menu;
import restaurant.SpecialOffers;
import restaurant.Tables;

class LoadData
{

	private Menu menu;
	private SpecialOffers offers;
	private Tables tables;
	private CustomerComments comments;
	private CustomerOrders orders;
	private CustomerTabs tabs;



	public LoadData() {
		InformationAggregator info = InformationAggregator.getInstance();

		menu = info.getMenu();
		loadMenu();

		offers = info.getOffers();
		loadOffers();

		tables = info.getTables();
		loadTables();

		comments = info.getComments();
		loadComments();
		loadRatings();

		orders = info.getOrders();
		loadOrders();

		tabs = info.getTabs();
		loadTabs();
	}



	private void loadMenu()
	{
		// TODO Auto-generated method stub

	}



	private void loadOffers()
	{
		DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
		try {
			offers.createOffer(formatter.parse("5/1/2012"),
					formatter.parse("5/14/2012"),
					"buy one get one free for dinner", 8);
			offers.createOffer(formatter.parse(" 5/2/2012"),
					formatter.parse(" 5/15/2012"), "half off cheeseburger", 3);
			offers.createOffer(formatter.parse(" 5/3/2012"),
					formatter.parse(" 5/6/2012"), "free cereal", 2);
			offers.createOffer(formatter.parse(" 5/7/2012"),
					formatter.parse(" 5/13/2012"),
					"free hot dog with any burger", 1.99);
			offers.createOffer(formatter.parse(" 5/14/2012"),
					formatter.parse(" 5/19/2012"), "half off salad", 1.5);
			offers.createOffer(formatter.parse(" 5/15/2012"),
					formatter.parse(" 5/20/2012"),
					"free drink with purchase of veggie burger", 2);
		}
		catch (ParseException e) {
			e.printStackTrace();
		}

	}



	private void loadTables()
	{
		tables.newTable();
		tables.newTable();
		tables.newTable();
		tables.newTable();
		tables.newTable();
		tables.newTable();
	}



	private void loadComments()
	{
		Comment off1, off2;

		comments.addComment("the food here is awesome");
		comments.addComment("I love it here. Will definitely be back");
		comments.addComment("This place sucks massively. Hate it. The worst.");
		comments.addComment("I love this place and will gladly give my firstborn to continue eating here forever");
		off1 = comments.addComment("I am a troll. Troll troll troll");
		comments.addComment("This place is great. The waitstaff is awesome");
		comments.addComment("The people who developed this program are so cool. They�re the best");
		comments.addComment("I�m coming here tomorrow. Because the food is good. And I don�t know how to cook.");
		off2 = comments.addComment("Offensive comments are offensive");
		comments.addComment("I am not an offensive comment.");

		comments.update(off1.getCommentNo());
		comments.update(off2.getCommentNo());
	}



	private void loadRatings()
	{
		comments.addRating(1, 3);
		comments.addRating(2, 4);
		comments.addRating(3, 4);
		comments.addRating(4, 3);
		comments.addRating(5, 4);
		comments.addRating(6, 3);
		comments.addRating(7, 4);
		comments.addRating(8, 4);
		comments.addRating(9, 3);
		comments.addRating(10, 4);
	}



	private void loadOrders()
	{
		// TODO Auto-generated method stub

	}



	private void loadTabs()
	{
		// TODO Auto-generated method stub

	}
}
